using System.ComponentModel.DataAnnotations;

namespace Warehouse.Dto
{
    /// <summary>
    /// 调拨单查询请求DTO
    /// </summary>
    public class AllocationQueryRequest
    {
        [Required]
        public int PageIndex { get; set; } = 1;

        [Required]
        public int PageSize { get; set; } = 10;

        public string? TransferNo { get; set; }
        public long? FromWarehouseId { get; set; }
        public long? ToWarehouseId { get; set; }
        public byte? BillStatus { get; set; }
        public byte? OutStatus { get; set; }
        public byte? InStatus { get; set; }
        public DateTime? BeginDate { get; set; }
        public DateTime? EndDate { get; set; }
    }

    /// <summary>
    /// 调拨单查询响应DTO
    /// </summary>
    public class AllocationQueryResponse
    {
        public int TotalCount { get; set; }
        public int TotalPage { get; set; }
        public List<AllocationQueryItemDto> Data { get; set; } = new();
    }

    /// <summary>
    /// 调拨单查询项DTO
    /// </summary>
    public class AllocationQueryItemDto
    {
        public long TransferId { get; set; }
        public string TransferNo { get; set; } = string.Empty;
        public DateTime ApplyDate { get; set; }
        public string TransferType { get; set; } = string.Empty;
        public long FromWarehouseId { get; set; }
        public string FromWarehouseName { get; set; } = string.Empty;
        public long ToWarehouseId { get; set; }
        public string ToWarehouseName { get; set; } = string.Empty;
        public byte BillStatus { get; set; }
        public string BillStatusName { get; set; } = string.Empty;
        public byte OutStatus { get; set; }
        public string OutStatusName { get; set; } = string.Empty;
        public byte InStatus { get; set; }
        public string InStatusName { get; set; } = string.Empty;
        public decimal TotalQty { get; set; }
        public decimal TotalAmount { get; set; }
        public string HandlerName { get; set; } = string.Empty;
        public string ApplicantName { get; set; } = string.Empty;
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
    }

    /// <summary>
    /// 调拨单详情查询DTO
    /// </summary>
    public class AllocationDetailQueryDto
    {
        public long TransferId { get; set; }
        public string TransferNo { get; set; } = string.Empty;
        public DateTime ApplyDate { get; set; }
        public string TransferType { get; set; } = string.Empty;
        public long FromWarehouseId { get; set; }
        public string FromWarehouseName { get; set; } = string.Empty;
        public long ToWarehouseId { get; set; }
        public string ToWarehouseName { get; set; } = string.Empty;
        public byte BillStatus { get; set; }
        public string BillStatusName { get; set; } = string.Empty;
        public byte OutStatus { get; set; }
        public string OutStatusName { get; set; } = string.Empty;
        public byte InStatus { get; set; }
        public string InStatusName { get; set; } = string.Empty;
        public decimal TotalQty { get; set; }
        public decimal TotalAmount { get; set; }
        public string HandlerName { get; set; } = string.Empty;
        public string ApplicantName { get; set; } = string.Empty;
        public string Remark { get; set; } = string.Empty;
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
        public List<AllocationLineQueryDto> Lines { get; set; } = new();
    }

    /// <summary>
    /// 调拨单详情查询请求DTO
    /// </summary>
    public class AllocationDetailRequest
    {
        [Required]
        public long TransferId { get; set; }
    }
}
